﻿<!DOCTYPE html>
<!--岗位安全职责考核管理编辑-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>
    
</head>

<body>
    <div id="app" v-cloak class="popupW150">
        <el-form :model="Form" state-icon :rules="rules" ref="ruleForm" label-width="100px" size="mini"
                 label-position="right">
            <el-row>
                <el-col :span="11">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input type="text" v-model="Form.taskName" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{"任务名称"+mark.m}}
                                </template>
                            </el-input>
                            <span class="iputLineMust" v-if="!Form.taskName">
                                <!-- 必填项添加 -->
                                <img src="/static/images/exclamation.png" alt="">
                            </span>
                        </el-form-item>
                    </div>
                </el-col>

               
            </el-row>
            
            <el-row>
                <el-col :span="24">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <div class="el-input--mini el-input-group">
                                <div class="el-input-group__prepend">
                                    {{"备注"+mark.m}}
                                </div>
                                <el-input class="el-textarea__inner" type="textarea" v-model="Form.remark"
                                          autocomplete="off"></el-input>
                            </div>
                        </el-form-item>
                    </div>
                </el-col>

            </el-row>
           

            <el-row type="flex" justify="end" style="margin-top:20px;">
                <el-form-item>
                    <!--<el-button type="primary" @click="onSubmitForm('ruleForm','0')">{{col.btnSave}}</el-button>-->
                    <el-button type="primary" @click="onSubmitForm('ruleForm','1')">{{col.btnSubmit}}</el-button>
                    <el-button type="primary" @click="parent.ListItem.dialogVisible=false">{{col.btnBack}}</el-button>
                </el-form-item>
            </el-row>
        </el-form>

    </div>
    <script type="text/javascript">
       
        app = new Vue({
            el: '#app',
            data: {
                //父业传参
                id: '',
                //mydata:[],// UsersTree,
                //业务表单内容
                Form: {
                    id: guidEmpty,
                    //postPerson:'',
                    //mark04: '',
                    taskName:'',
                    remark: '',
                    //theme:'',
                    //assessmentSubject:'',
                    //assessmentYear: '',
                    //postSafeProductionScope: '',
                    state:'0',
                    //jG_JobsAssessDetail: [],
                    //tableData:[],
                },
               
                ////表格显示开关
                //showTable: true,
                //表单验证
                rules: {
                    taskName: [
                        verification.NotNull,
                    ]
                }
            },
            
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                //表格序号连续化
                indexMethod: function (index) { return index + 1; },
                //提交数据
                //onSubmitForm: function (formName) {
                //    var mythis = this;
                //    this.$refs[formName].validate(function (valid) {
                //        //验证通过
                //        if (valid) {
                //            mythis.Form.state = state;
                //            mythis.Form.postID = mythis.departmentId;
                //            mythis.Form.postNameID = mythis.dutyId;
                //            //mythis.Form.theme = mythis.Form.assessmentSubject
                //            //mythis.Form.jG_JobsAssessDetail = mythis.Form.tableData
                //            onSubmitForm(this, '/api/JG_JobsAssess/Save', mythis.Form);
                //        } else {
                //            //验证失败
                //            return false;
                //        }
                //    });

                //},
                onSubmitForm: function (formName, state) {
                    var mythis = this;
                    
                    this.$refs[formName].validate(function (valid) {
                        //验证通过
                        if (valid) {

                            if (mythis.Form.taskName == null || mythis.Form.taskName == "" || mythis.Form.taskName == undefined) {
                                alert('请输入任务名称');
                                return false;
                            }
                            mythis.Form.state = state;
                            if (mythis.id != null) {
                                mythis.Form.id = mythis.id;
                               
                                onSubmitForm(this, '/api/CBS_DayCheckTask/Save', mythis.Form);
                                    //执行完毕
                                    showMessage(msg.OperatingOk, 'success');
                                    parent.app.ListItem.dialogVisible = false;
                               

                                
                            } else {
                                onSubmitForm(this, '/api/CBS_DayCheckTask/Save', mythis.Form);
                                //执行完毕
                                showMessage(msg.OperatingOk, 'success');
                                parent.app.ListItem.dialogVisible = false;
                            }
                        }else {
                            //验证失败
                            return false;
                        }
                    });

                },
                getData: function () {
                    var mythis = this;
                    if (mythis.id != null && mythis.id != '') {
                        myAjax("get", mythis, '/api/CBS_DayCheckTask/get?id=' + this.id, null, function (response) {
                            var ajaxModel = response.data;
                            mythis.Form = ajaxModel;
                        }, false);
                    }
                },
                
            },
            mounted: function () {
               
                this.id = getUrlParam("id");
                this.getData();
                
                console.log('this.Form', this.Form)
            }
        });
    </script>
</body>

</html>